package j.framework.tags.easyui;

import j.util.StringUtils;

import javax.servlet.jsp.JspException;
import java.util.Map;

/**
 * 所有有下拉面板的控件都继承此类
 * Created by junhai on 2015/1/17.
 */
public abstract class BaseEasyuiComboFormControl extends BaseEasyuiFormControl {
    private Integer panelWidth;
    private Integer panelHeight;
    /**
     * 当文本域的值改变的时候触发。
     * 方法签名：newValue, oldValue
     */
    private String onChange;
    @Override
    public void writeEasyuiDataOptions(Map<String, Object> dataOptions) throws JspException {
        if(null!=panelWidth && panelWidth>0){
            dataOptions.put("panelWidth",panelWidth);
        }
        if(null!=panelHeight && panelHeight>0){
            dataOptions.put("panelHeight",panelHeight);
        }
        if(StringUtils.isNotEmpty(onChange)){
            dataOptions.put("onChange",onChange);
        }
    }

    public void setPanelWidth(Integer panelWidth) {
        this.panelWidth = panelWidth;
    }

    public void setPanelHeight(Integer panelHeight) {
        this.panelHeight = panelHeight;
    }

    public void setOnChange(String onChange) {
        this.onChange = onChange;
    }
}
